package com.jcourse.bookstore;
import java.util.Scanner;
public class IntegerAdd {

	public static void main(String[] args) {
		int result = add(100);
		int average=average(10);

	}
	
	static int add(int n) {
		int result =0;
		for (int i=0; i<=100; i++) {
			result += i;
			
		}
		return 0;
	}
	
	
	static int whileadd(int n) {
		int result =0;
		int i =1;
		while(i<=100) {
			result +=i;
			i++;
		}
		return result;
	}
	
	
	static int dowhileadd(int n) {
		int result =0;
		int i =1;
		 do {
			 result +=i;
				i++;
		 }while(i<=100);
		 return result;
	}
	

	static int average(int n) {
		Scanner scan=new Scanner(System.in);
		int sum =0;
		for (int i=1; i<=n;i++){
			System.out.println("输入你" +i +"几门课的成绩：");
			int level=scan.nextInt();
			sum += level;
		}
		int average=sum/n;
		return average;
	}
}